import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;

public class OptionPaneMultiple extends JFrame
{
	String rounds;
	String A;
	String a;
	String B;
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;


	public OptionPaneMultiple()
	{
		JLabel text = new JLabel("PAY = A*(MONEYLEFT)^(1-a)*TOTALGIVEN^a+B...");
		JTextField A = new JTextField("1");
		JTextField a = new JTextField(".5");
		JTextField B = new JTextField("10");
		JTextField R = new JTextField("3");
		Object[] msg = {text, "A:", A, "a:", a, "B:", B, "Rounds:", R};
 
		JOptionPane op = new JOptionPane(
			msg,
			JOptionPane.QUESTION_MESSAGE,
			JOptionPane.OK_CANCEL_OPTION,
			null,
			null);
 
		JDialog dialog = op.createDialog(this, "Payout Equation");
		dialog.setVisible(true);
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
 
		int result = JOptionPane.OK_OPTION;
 
		try
		{
		    result = ((Integer)op.getValue()).intValue();
		}
		catch(Exception uninitializedValue)
		{}
 
		if(result == JOptionPane.OK_OPTION)
		{
			this.A = A.getText();
			this.a = a.getText();
			this.B = B.getText();
			this.rounds = R.getText();
			setVisible(false);
		}
		else
		{
			System.exit(1);
		}
 
	}
 
 
	public static void main(String[] args)
	{
		JFrame frame = new OptionPaneMultiple();
		frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
	}
}